package com.gitee.wsl.flowing.actionflow

interface PipeLineFlow: Action {

    fun all(vararg action: Action)

    fun any(vararg action: Action)

    fun allNot(vararg action: Action)

    suspend fun process():Boolean

    fun and(action: Action)

    fun or(action: Action)

    fun not(action: Action)

    //用于流转
    fun ifGoto(actionGoto: (context: PipeLineFlowContext)-> Action?)
}

interface PipeLineFlowScope: PipeLineFlow {

    fun initContext(configContext: PipeLineFlowContext.()->Unit)

    fun andSubPipeLine(config: PipeLineFlowScope.()->Unit)

    fun orSubPipeLine(config: PipeLineFlowScope.()->Unit)
}

fun samplePipeLineFlow(config: PipeLineFlowScope.()->Unit): PipeLineFlow {

    val pipeLineImp = PipeLineFlowScopeImp()

    config(pipeLineImp)

    return pipeLineImp
}

